<template>
  <div class="maincontent">
    <h3>{{ newsinfo.title }}</h3>
    <p class="mui-ellipsis">
      <span>发表时间：{{ newsinfo.add_tine | dateFormat }}</span>
      <span>点击次数：{{ newsinfo.click }}</span>
    </p>
    <hr />
    <div class="content" v-html="newsinfo.content"></div>
    <commmet></commmet>
  </div>
</template>

<script>

import commmet  from '../subComponent/Comment.vue'

export default {
  data() {
    return {
      newsinfo: {},
    };
  },
  created() {
    this.getNewsDetail();
  },
  methods: {
    async getNewsDetail() {
      const url = "/api/getnew/" + this.id;
      const { data } = await this.$http.get(url);
      if (data.status == 0) this.newsinfo = data.message[0];
    },
  },
  props: ["id"],
  components :{
      commmet: commmet
  }
};
</script>

<style lang="scss" scoped>
.maincontent{
    padding : 3px;
    h3{
        font-size: 16px;
        text-align: center;
        color:red
    }
    .mui-ellipsis{
        margin: 5px;
        color:cornflowerblue;
        display: flex;
        justify-content: space-between;
    }

}
</style>